package org.geeks.gsrest.biz.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * HelloController
 * 
 * @author Geek-S
 *
 */
@RestController
public class HelloController {

	/**
	 * hello -> with authority
	 * 
	 * @return message
	 */
	@GetMapping("hello")
	@PreAuthorize("hasAuthority('hello')")
	public String hello() {
		return "Hello, world ~";
	}

	/**
	 * hello1 -> with authority
	 * 
	 * @return message
	 */
	@GetMapping("hello1")
	@PreAuthorize("hasAuthority('hello1')")
	public Object hello1() {
		return "Hello, world ~ 1";
	}

	/**
	 * hello2 -> mock 500
	 * 
	 * @return message
	 */
	@GetMapping("hello2")
	public String hello2() {
		Integer.parseInt("hello2");
		return "Hello, world ~ 2";
	}

	/**
	 * hello3 -> mock 400
	 * 
	 * @return message
	 */
	@GetMapping("hello3")
	public String hello3(Integer number) {
		return "Hello, world ~ 3";
	}
}
